home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Technotools
/
Technotools (Chestnut CD-ROM)(1993).ISO
/
lang_c
/
mc51bugs
/
q30501
< prev
next >
Wrap
Text File
|
1988-07-20
|
1KB
|
48 lines
Q30501 Incorrect Code for Function Call
C Compiler
5.10
MS-DOS
Summary:
The compiler will generate incorrect code for the call to the
function strcpy in the example below. The compiler is trying to use
the association
macronames[nmacros]=macropointer=macrobuffer+totalmac
by pushing macrobuffer+totalmac as the first parameter to the
function; however, the value of totalmac has changed so that the
macronames[nmacros] is no longer equal to macrobuffer+totalmac.
#include <stdio.h>
#include <string.h>
#define MACROBUFFERSIZE 800
#define MAXMACROS 10
int macfileh,nrmacros=0;
char macrobuffer[MACROBUFFERSIZE],*macronames[MAXMACROS];
void openfiles()
{
char line[128];
int totalmac;
char *macropointer =macrobuffer;
macropointer=macrobuffer+totalmac;
macronames[nrmacros]=macropointer;
totalmac += 1;
if(totalmac<=MACROBUFFERSIZE)
strcpy(macronames[nrmacros],line); /* does not work*/
}
Response:
Microsoft has confirmed this to be a problem in Version 5.10
of the C compiler.
You can work around the problem by calling the function strcpy with
the variable macropointer instead of the variable
macronames[nrmacros].
Microsoft is researching this problem and will post new information
as it becomes available.
Keywords: buglist5.10
Updated 88/07/21 03:19